//@author A0101906R
#ifndef CMD_H
#define CMD_H

#include <iostream>
#include <string>
#include <assert.h>
#include "CommonObjects.h"
#include "Storage.h"



namespace Twentyfifth {
	class Cmd {
	public:
		enum CmdType { ADD, EDIT, VIEW, SEARCH, DEL, UNDO, EXIT, MARK, GCAL, INVALID };
	protected:

		Task task;
		StorageMgr* storage;
	public:
		CmdType cmdType;
		static const std::string FEEDBACK_ERR_VOID;
		static const std::string FEEDBACK_ERR_END_OF_FILE;
		static const std::string FEEDBACK_ERR_INVALID_COMMAND;
		static const std::string FEEDBACK_ERR_TASK_NOT_FOUND;
		static const std::string FEEDBACK_ERR_NO_RECORDS;
		static const std::string FEEDBACK_ERR_NO_RESULT;
		static const std::string FEEDBACK_EXIT;
		static const std::string FEEDBACK_OK;
		static const std::string ERROR_UNSUCCESSFUL;

		bool descEdited;
		bool venueEdited;
		bool startDateEdited;
		bool startTimeEdited;
		bool endTimeEdited;
		bool endDateEdited;
		bool deadlineDateEdited;
		bool deadlineTimeEdited;
		bool done;
		bool detailsEdited;

		std::string userCommand;
		std::string searchString;
		DateTime searchDate;

		Cmd();
		static CmdType identifyCmdType(std::string);
		//setters
		void setCmdType(CmdType);
		void setTask(Task newTask);
		void setStorageMgr(StorageMgr* storagemgr);
		//getters	
		CmdType getCmdType();
		Task getTask();
		DateTime getCurrentDateTime();
		//executions	
		virtual Status execution();
		virtual Status undo(Status::StatusCode);
		//convert to strings
		std::string toString();
		std::string statusCodeToString(Status);
		void print();

	};

}
#endif